package alex.game.updatable.map
{
	import com.framework.IUpdatable;
	import com.framework.util.Log;
	
	import flash.display.MovieClip;
	import alex.game.updatable.plane.BasicPlane;
	
	public class BasicMap extends MovieClip implements IUpdatable
	{
		protected var affichage:MovieClip;
		private var trans:Number = 1;
		private var plane_list:Array;
		
		private var plane_layer:MovieClip;
		
		public function BasicMap()
		{
			
		}
		
		public function create():void
		{
			plane_layer = new MovieClip();
			plane_list = new Array();
			
			this.addChild(affichage);
			
			this.affichage.addChild(plane_layer);
		}
		
		public function destroy():void
		{
			this.plane_list = null;
		}
		
		public function update():void
		{
			for each(var p:BasicPlane in plane_list)
			{
				p.update();
			}
		}
		
		public function addPlane(plane:BasicPlane):void
		{
			Log.debug(this,"Add plane");
			plane.create();
			
			plane_list.push(plane);
			plane.x = 50;
			plane.y = 50;
			plane_layer.addChild(plane);
			
		}
	}
}